const express = require('express');
const router = express.Router();
const data = [];
for(let i = 1; i < 51; i++)
    data.push({
        id: `${i}`,
        orderCode: `XS2019082700-${i}`,
        partOrderTypeName: '紧急订单',
        partOrderPriceTerms: 1,
        paymentType: 1,
        status: 1,
        piCode: `PI2019090400-${i}`,
        transportType: 1,
        submitTime: '2019-09-04T02:37:44.918Z',
        dealerCode: '10145',
        dealerName: '测试经销商',
        isSeparate: !(i % 2),
        labelRequirement: '无',
        palletizing: 1,
        shippingMark: '无'
    });
router.get('/', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            id: '1',
            orderCode: 'XS2019082700-1',
            partOrderTypeName: '紧急订单',
            partOrderPriceTerms: 1,
            paymentType: 1,
            status: 1,
            piCode: 'PI2019090400-1',
            transportType: 1,
            submitTime: '2019-09-04T02:37:44.918Z',
            dealerCode: '10145',
            dealerName: '测试经销商',
            isSeparate: true,
            labelRequirement: '无',
            palletizing: 1,
            shippingMark: '无',
            cabinetType: 1,
            isEngine: true,
            isDangerousGoods: 'Y',
            isAirMagneticCheck: 'N',
            isChemicalCheck: 'Y',
            details: [
                {
                    partId: '1',
                    partCode: 'partCode1',
                    partName: 'partName1',
                    planQuantity: 3,
                    businessCheck: false,
                    dangerousGoods: true,
                    airMagneticCheck: false,
                    chemicalCheck: true,
                },
                {
                    partId: '2',
                    partCode: 'partCode2',
                    partName: 'partName2',
                    planQuantity: 6,
                    businessCheck: true,
                    dangerousGoods: false,
                    airMagneticCheck: true,
                    chemicalCheck: false,
                },
                {
                    partId: '3',
                    partCode: 'partCode3',
                    partName: 'partName3',
                    planQuantity: 9,
                    businessCheck: false,
                    dangerousGoods: true,
                    airMagneticCheck: true,
                    chemicalCheck: false,
                }
            ]
        }
    });
});
router.get('/export', (req, res) => {
    res.json({
        message: '导出成功',
        payload: 'Mock导出'
    });
});
router.post('/', (req, res) => {
    res.json({
        message: '新增成功'
    });
});
module.exports = router;
